#ifndef PRAXIS_UI_GENERIC_PROPERTY_EDITOR_DIALOG_H_
#define PRAXIS_UI_GENERIC_PROPERTY_EDITOR_DIALOG_H_

#include <windows.h>

#include <memory>
#include <string>

#include "praxis/core/backend_stubs.h"

namespace praxis {
/**
 * @class CGenericPropertyEditorDialog
 * @brief A general-purpose modal dialog for editing a JSON object.
 *
 * This dialog dynamically generates UI controls based on a provided JSON schema
 * to allow editing of a corresponding JSON data object. It's used for things
 * like editing global system parameters.
 */
class PRAXIS_API CGenericPropertyEditorDialog {
 public:
  /**
   * @brief Constructs the dialog.
   * @param h_parent The parent window handle.
   * @param data A reference to the JSON data object to be edited.
   * @param schema A const reference to the schema defining the data's
   * structure.
   * @param title The title for the dialog window.
   */
  CGenericPropertyEditorDialog(HWND h_parent, json& data, const json& schema,
                               const std::wstring& title);
  ~CGenericPropertyEditorDialog();

  CGenericPropertyEditorDialog(const CGenericPropertyEditorDialog&) = delete;
  CGenericPropertyEditorDialog& operator=(const CGenericPropertyEditorDialog&) =
      delete;

  /**
   * @brief Displays the modal dialog.
   * @return IDOK if the user clicks OK, IDCANCEL otherwise.
   */
  INT_PTR DoModal();

 private:
  struct Impl;
  std::unique_ptr<Impl> impl_;
};
}  // namespace praxis

#endif  // PRAXIS_UI_GENERIC_PROPERTY_EDITOR_DIALOG_H_
